package com.liuyun.sunadmin.controller;


import com.liuyun.sunadmin.model.RespBean;
import com.liuyun.sunadmin.pojo.AdminUser;
import com.liuyun.sunadmin.query.AdminQuery;
import com.liuyun.sunadmin.service.IAdminUserService;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.Map;

/**
 * <p>
 * 超管用户记录表 前端控制器
 * </p>
 *
 * @author 老傅xsx
 * @since 2021-09-14
 */
@Controller
@RequestMapping("/admin_user")
public class AdminUserController {

    @Resource
    IAdminUserService adminUserService;

    @RequestMapping("login")
    @ResponseBody
    public RespBean login(HttpSession session, AdminUser user){
        adminUserService.login(user);
        session.setAttribute("user",user);
        return RespBean.success("登录成功");

    }


    // 用户列表查询接口
    @RequestMapping("list")
    @ResponseBody
    public Map<String,Object> adminList(AdminQuery adminQuery){
        return adminUserService.adminList(adminQuery);

    }



    @RequestMapping("index")
    public String index(){
        return "admin/index";
    }





}
